<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css"/>
    <link type="text/css" href="../css/h5-aura.css" rel="stylesheet"/>
    <link type="text/css" href="../css/h5-channel-aura.css" rel="stylesheet"/>
    <link type="text/css" href="../css/h5-play-aura.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../css/play.css"/>
</head>
<style>
    .aui-flexView {
        width: 100%;
        height: 100%;
        margin: 0 auto;
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -webkit-flex-direction: column;
        -ms-flex-direction: column;
        flex-direction: column;
    }

    .aui-scrollView {
        width: 100%;
        height: 100%;
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        -ms-flex: 1;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    .aui-navBar {
        height: 44px;
        position: relative;
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        background-color: #1b7dff;
    }

    .aui-navBar-item {
        height: 44px;
        min-width: 25%;
        -webkit-box-flex: 0;
        -webkit-flex: 0 0 25%;
        -ms-flex: 0 0 25%;
        flex: 0 0 25%;
        padding: 0 0rem;
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-align: center;
        -webkit-align-items: center;
        -ms-flex-align: center;
        align-items: center;
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        color: #808080;
        position: relative;
    }

    .aui-navBar-item:first-child {
        -webkit-box-ordinal-group: 2;
        -webkit-order: 1;
        -ms-flex-order: 1;
        order: 1;
        margin-right: -25%;
        font-size: 0.9rem;
        font-weight: bold;
    }

    .aui-navBar-item:last-child {
        -webkit-box-ordinal-group: 4;
        -webkit-order: 3;
        -ms-flex-order: 3;
        order: 3;
        -webkit-box-pack: end;
        -webkit-justify-content: flex-end;
        -ms-flex-pack: end;
        justify-content: flex-end;
    }

    .aui-center {
        -webkit-box-ordinal-group: 3;
        -webkit-order: 2;
        -ms-flex-order: 2;
        order: 2;
        display: -webkit-box;
        display: -webkit-flex;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: center;
        -webkit-justify-content: center;
        -ms-flex-pack: center;
        justify-content: center;
        -webkit-box-align: center;
        -webkit-align-items: center;
        -ms-flex-align: center;
        align-items: center;
        height: 44px;
        width: 50%;
        margin-left: 25%;
    }

    .icon {
        width: 20px;
        height: 20px;
        display: block;
        border: none;
        float: left;
        background-size: 20px;
        background-repeat: no-repeat;
    }
    .icon-return {
        background-image: url("");

    }
</style>
<body>
<header class="aui-navBar aui-navBar-fixed" id="aui-header">
    <a onclick="closeWin()" class="aui-navBar-item">
        <i class="icon icon-return"></i>
    </a>
    <div class="aui-center">
        <span class="aui-center-title1" id="title" style="font-size: 0.18rem;">播放中心</span>
    </div>
    <a class="aui-navBar-item">
        <i class="icon icon-sys"></i>
    </a>
</header>
<img height="200px"/>
<!--<iframe src="http://zhys.123cf.top" width="100%" height="100%"></iframe>-->
<section class="m-video-extendBar iqiyi-down-load-extend">
    <div class="m-video-pp"></div>
    <div class="m-video-pindaoType hide">电视剧</div>
    <div class="m-toast-layer m-player-toast dn"></div>
</section>
<!--分享-->
<div id="fenx" class="m-share-tip" style="display:none">
    <a onclick="fenxiang('wx')" class="share-item">
        <i class="c-icon-share c-icon-share-weixin"></i>
        <span class="c-info">微信好友</span>
    </a>
    <a onclick="fenxiang('qq')" class="share-item">
        <i class="c-icon-share c-icon-share-qq"></i>
        <span class="c-info">QQ</span>
    </a>
    <a onclick="fenxiang('fzlj')" class="share-item">
        <i class="c-icon-share c-icon-share-link"></i>
        <span class="c-info">复制链接</span>
    </a>
</div>
<!-- 收藏，举报，问题 -->
<div id="fenxgd" class="m-stow-report-faq #if($isNewBar)shortPlay-stowReportFaq#end" style="display:none">
    <!--已收藏video-action-btn 追加类 selected -->
    <a onclick="alert('开发中')" class="c-link">
        <i class="c-extendBar-icon extendBar-stow"></i>
        <span class="c-info">收藏</span>
    </a>
    <a onclick="alert('开发中')" class="c-link">
        <i class="c-extendBar-icon extendBar-report"></i>
        <span class="c-info">举报</span>
    </a>
    <a onclick="alert('开发中')" class="c-link">
        <i class="c-extendBar-icon extendBar-faq"></i>
        <span class="c-info">播放遇到问题</span>
    </a>
</div>
<div class="m-box-items m-box-items-full" id="videoInfo" style="display:block">
    <div class="m-video-info">
        <div class="video-title">
            <h1 id="zming" class="c-title"><a class="c-title-link">-----------</a>第--集 </h1>
        </div>
        <div class="video-data">
            <div id="qj" class="data-info">
                48集全
            </div>
            <div id="zy" class="data-info">
                主演: 郑元畅,张铭恩,黄梦莹,季晨,熊乃瑾,王闯,朱杰（男）,肖燕,姚橹,李宗翰,赵峥
            </div>
        </div>
    </div>
</div>
<div class="m-box" id="seleInfo">
    <div class="m-box-items m-box-items-full">
        <section onclick="xuanji()" class="m-title m-title-anthology">
            <h3 class="c-title-des">下方选择播放源：</h3>
            <span class="c-des"> 当前播放源：<em id="xsbfy">---</em> </span>
        </section>
    </div>
</div>
<div id="xuanji1"></div>
<div id="xuanji"></div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/doT.js"></script>
<script type="text/javascript" src="../script/date.min.js"></script>
<script type="text/javascript" src="../script/zepto.js"></script>
<script type="text/javascript">
    var api_url = localStorage.getItem('api_url');
    var uzmoduledemo;
    var TVURL;
    var namen;
    var arr1; //
    var play; //播放参数
    var xiazai; //下载参数
    var bianl; //选集变量
    var img; //图片地址
    var bfy; //播放源名称
    var bofang; //播放地址
    var dqbfy = 0;
    var boflx; //播放名称
    //  api.pageParam.url
    var dwzapi = '';
    var value = '';
    apiready = function () {
        api.setScreenOrientation({
            orientation: 'auto' //屏幕根据重力感应在横竖屏间自动切换 auto_portrait
        });
        api.parseTapmode();
        var header = $api.byId('aui-header');
        $api.fixStatusBar(header);
        var headerPos = $api.offset(header);
        var body_h = $api.offset($api.dom('body')).h;
        api.ajax({
            url: api_url + '/login/login/sosuoid',
            data: {
                values: {
                    id: api.pageParam.id,
                }
            }
        }, function (ret, err) {
            if (ret) {
                // alert(JSON.stringify(ret[0].vod_play_url));
                //播放参数划分
                play = ret[0].vod_play_url; //获取视频播放数据--未分割
                var jishu = play.split("$$$"); //播放数据分割
                var arr = jishu[0].split("#"); //每一集分割

                xiazai = ret[0].vod_down_url; //获取视频下载数据--未分割
                var xz = xiazai.split("$$$"); //下载数据分割
                arr1 = xz[0].split("#"); //第一集分割

                namen = ret[0].vod_name; //视频名称
                bfy = ret[0].vod_play_from; //获取播放源名称--未分割

                img = ret[0].vod_pic; //视频图片

                var shs = arr[0].split("$"); //分割第一集名字,图片
                bofang = shs[1]; //获取第一集播放地址
                var ming = $api.byId('zming'); //获取显示名称id
                ming.innerHTML = "<a  class='c-title-link' glue-node='albumLink'>" + ret[0].vod_name + "&nbsp;</a> " + shs[0];
                var qj = $api.byId('qj'); //显示集数id
                qj.innerHTML = ret[0].vod_remarks;
                var zy = $api.byId('zy'); //显示主演id
                zy.innerHTML = "主演：" + ret[0].vod_actor;

                bianl = 0; //当前播放集数变量   0为第一集以此类推

                var bofangqi = $api.byId('xuanji1');
                var from1 = ret[0].vod_play_from;
                var jishu = from1.split("$$$");
                boflx = jishu[0];
                $api.byId('xsbfy').innerHTML = jishu[0]; //显示默认播放源
                var html = '';
                var ji = jishu.length;
                html +=
                    '<section name="m-tagSearch" class="m-sortList-wrap m-sliding sortList-border"><ul id="shaixuan1" class="m-sortList m-sliding-list" >';
                for (i = 0; i < ji; i++) {
                    var nnma;
                    if (jishu[i] == "qq") {
                        nnma = "腾讯视频";
                    } else if (jishu[i] == "qiyi") {
                        nnma = "爱奇艺";
                    } else if (jishu[i] == "youku") {
                        nnma = "优酷";
                    } else if (jishu[i] == "mgtv") {
                        nnma = "芒果";
                    } else if (jishu[i] == "sohu") {
                        nnma = "搜狐";
                    } else if (jishu[i] == "letv") {
                        nnma = "乐视";
                    } else if (jishu[i] == "pptv") {
                        nnma = "PPTV";
                    } else {
                        nnma = jishu[i];
                    }

                    html += '<li onclick=\"qhbfy(' + i + ')\" style="pointer-events: auto;"><a class="c-sortlist-item selected">' +
                        nnma + '</a></li>';
                }
                html += '</ul></section>';
                bofangqi.innerHTML = html;

                var header = $api.byId('aui-header');
                $api.fixStatusBar(header);
                var headerPos = $api.offset(header);
                var body_h = $api.offset($api.dom('body')).h;

                //获取导航id

                var reg = RegExp(/m3u8/);
                if (reg.exec(bofang)) { //判断当前播放视频是否为m3u8是则通过解析播放不是直接播放连接
                    playbo = localStorage.getItem('jx_url5') +bofang;
                } else {
                    if (boflx == "qq") {
                        playbo = localStorage.getItem('jx_url5') + bofang;
                    } else if (boflx == "qiyi") {
                        playbo = localStorage.getItem('jx_url5') + bofang;
                    } else if (boflx == "youku") {
                        playbo = localStorage.getItem('jx_url5') + bofang;
                    } else if (boflx == "mgtv") {
                        playbo = localStorage.getItem('jx_url5') + bofang;
                    } else if (boflx == "sohu") {
                        playbo = localStorage.getItem('jx_url5') + bofang;
                    } else if (boflx == "letv") {
                        playbo = localStorage.getItem('jx_url5') + bofang;
                    } else if (boflx == "pptv") {
                        playbo = localStorage.getItem('jx_url5') + bofang;
                    } else {
                        playbo = bofang;
                    }


                }
                // if (api.systemType == 'android') {
                //     uzmoduledemo = api.require('androidBrowser');
                //     var param = {
                //         rect: {
                //             x: 0,
                //             y: 70,
                //             w: 1,
                //             h: 1,
                //         },
                //         fixedOn: "",
                //         fixed: true,
                //         url: playbo,
                //         browserBg: "#F0F0F0",
                //         timeout: 7,
                //
                //     };
                //     uzmoduledemo.openView(param, function (ret, err) {
                //         //alert(JSON.stringify(ret));
                //         if (ret.result == '1') {
                //             TVURL = ret.VideoUrl;
                //             uzmoduledemo.closeView(function (ret, err) {
                //                 //alert(JSON.stringify(ret));
                //             });
                //         }
                //     });
                // }
                var browser = api.require('webBrowser');
                browser.openView({
                    url: playbo,
                    rect: {
                        x: 0,
                        y: headerPos.h,
                        w: 'auto',
                        h: 200,
                    }
                }, function (ret, err) {
                    switch (ret.state) {
                        case 0:
                            break;
                        case 1:
                            break;
                        case 2:
                            break;
                        case 3:
                            break;
                        case 4:
                            break;
                        default:
                            break;
                    }
                });

                //输出集数
                var navtjid = $api.byId('xuanji'); //获取显示集数id
                var html = '';
                var ji = arr.length;
                html += '<section name="m-digit" class="m-album-num clearfix">';
                for (i = 0; i < ji; i++) {
                    var i1 = i + 1;
                    var fess = arr[i].split("$");
                    html += "<a class='c-album-item' onclick=\"toBanners('" + arr[i] + "','" + i + "')\"><span class='num'>" +
                        fess[0] +
                        "</span><div class='c-rt'></div><span class='album-current hide'><i class='c-glyphicon c-glyphicon-albumPlay'></i></span></a>";
                }
                html += '</section>';
                navtjid.innerHTML = html;
            }
        });
    };
    function qhbfy(a) {
        if (dqbfy == a) {
            alert('已经在此播放源,不需要切换');
        } else {
            var jishu = bfy.split("$$$");
            var nnma;
            if (jishu[a] == "qq") {
                nnma = "腾讯视频";
            } else if (jishu[a] == "qiyi") {
                nnma = "爱奇艺";
            } else if (jishu[a] == "youku") {
                nnma = "优酷";
            } else if (jishu[a] == "mgtv") {
                nnma = "芒果";
            } else if (jishu[a] == "sohu") {
                nnma = "搜狐";
            } else if (jishu[a] == "letv") {
                nnma = "乐视";
            } else if (jishu[a] == "pptv") {
                nnma = "PPTV";
            } else {
                nnma = jishu[a];
            }
            boflx = jishu[a];
            $api.byId('xsbfy').innerHTML = nnma; //切换播放源名称


            //输出集数
            var navtjid = $api.byId('xuanji'); //获取显示集数id
            var yifen = play.split("$$$"); //一次分割
            var erfen = yifen[a].split("#"); //二次分割获取所有播放列表

            var html = '';
            var ji = erfen.length; //获取集数长度
            html += '<section name="m-digit" class="m-album-num clearfix">';
            for (i = 0; i < ji; i++) {
                var i1 = i + 1;
                var fess = erfen[i].split("$");
                html += "<a class='c-album-item' onclick=\"toBanners('" + erfen[i] + "','" + i + "')\"><span class='num'>" + fess[
                        0] +
                    "</span><div class='c-rt'></div><span class='album-current hide'><i class='c-glyphicon c-glyphicon-albumPlay'></i></span></a>";
            }
            html += '</section>';
            navtjid.innerHTML = html;
            var slsl = erfen[0].split("$");
            var xds = $api.byId('zming');
            xds.innerHTML = "<a  class='c-title-link' glue-node='albumLink'>" + namen + "&nbsp;</a> " + slsl[0];
            var reg = RegExp(/m3u8/);
            if (reg.exec(slsl[1])) {
                playbo = localStorage.getItem('jx_url5') +slsl[1];
            } else {
                if (boflx == "qq") {
                    playbo = localStorage.getItem('jx_url5') + slsl[1];
                } else if (boflx == "qiyi") {
                    playbo = localStorage.getItem('jx_url5') + slsl[1];
                } else if (boflx == "youku") {
                    playbo = localStorage.getItem('jx_url5') + slsl[1];
                } else if (boflx == "mgtv") {
                    playbo = localStorage.getItem('jx_url5') + slsl[1];
                } else if (boflx == "sohu") {
                    playbo = localStorage.getItem('jx_url5') + slsl[1];
                } else if (boflx == "letv") {
                    playbo = localStorage.getItem('jx_url5') + slsl[1];
                } else if (boflx == "pptv") {
                    playbo = localStorage.getItem('jx_url5') + slsl[1];
                } else {
                    playbo = slsl[1];
                }

            }
            // if (api.systemType == 'android') {
            //     uzmoduledemo = api.require('androidBrowser');
            //     var param = {
            //         rect: {
            //             x: 0,
            //             y: 70,
            //             w: 1,
            //             h: 1,
            //         },
            //         fixedOn: "",
            //         fixed: true,
            //         url: playbo,
            //         browserBg: "#F0F0F0",
            //         timeout: 7,
            //
            //     };
            //     uzmoduledemo.openView(param, function (ret, err) {
            //         //alert(JSON.stringify(ret));
            //         if (ret.result == '1') {
            //             TVURL = ret.VideoUrl;
            //             uzmoduledemo.closeView(function (ret, err) {
            //                 //alert(JSON.stringify(ret));
            //             });
            //         }
            //     });
            // }
            //alert(api.pageParam.video);
            bofang = slsl[1];
            var browser = api.require('webBrowser');
            browser.loadUrl({
                url: playbo
            });

            dqbfy = a;
            alert('切换完成');


        }
    }
    function fenxiang(leix) {
        api.ajax({
            url: 'http://suo.im/api.htm?format=json&url=' + dwzapi + '&key=5d79adb9b1a9c71d20af521e@13c666f4f75d74d90b6c11dc3201ee67&expireDate=2050-01-01',
            method: 'get'
        }, function (ret, err) {
            if (ret) {

                value = app_Invitation_slogans + '：' + ret.url;


            } else {

                value = app_Invitation_slogans + '：' + dwzapi;
            }
        });
        if (leix == "wx") {
            var wx = api.require('wx');
            wx.shareText({
                apiKey: '',
                scene: 'timeline',
                text: '想看【' + namen + '】最新全集？' + value
            }, function (ret, err) {
                if (ret.status) {
                    alert('分享成功');
                } else {
                    alert(err.code);
                }
            });
        } else if (leix == "qq") {
            var qq = api.require('QQPlus');
            qq.shareText({
                text: '想看【' + namen + '】最新全集？' + value
            }, function (ret, err) {
                if (ret.status) {
                    alert('分享成功');
                } else {
                    api.alert({
                        msg: JSON.stringify(err)
                    });
                }
            });
        } else if (leix == "fzlj") {
            var clipBoard = api.require('clipBoard');
            clipBoard.set({
                value: '想看【' + namen + '】最新全集？' + value
            }, function (ret, err) {
                if (ret) {
                    api.toast({
                        msg: '已复制到剪切板',
                        duration: 2000
                    });
                } else {

                }
            });
        }
        ;


    }
    function closeWin() {
        api.closeWin({});
    }
    function toBanners(url, id) {
        var fenge = url.split("$");
        bianl = id;


        var ming = $api.byId('zming');
        ming.innerHTML = "<a class='c-title-link' glue-node='albumLink'>" + namen + "&nbsp;</a> " + fenge[0];

        var header = $api.byId('aui-header');

        var headerPos = $api.offset(header);

        var reg = RegExp(/m3u8/);
        if (reg.exec(fenge[1])) {
            playbo = localStorage.getItem('jx_url5') + fenge[1];
        } else {
            if (boflx == "qq") {
                playbo = localStorage.getItem('jx_url5') + fenge[1];
            } else if (boflx == "qiyi") {
                playbo = localStorage.getItem('jx_url5') + fenge[1];
            } else if (boflx == "youku") {
                playbo = localStorage.getItem('jx_url5') + fenge[1];
            } else if (boflx == "mgtv") {
                playbo = localStorage.getItem('jx_url5') + fenge[1];
            } else if (boflx == "sohu") {
                playbo = localStorage.getItem('jx_url5') + fenge[1];
            } else if (boflx == "letv") {
                playbo = localStorage.getItem('jx_url5') + fenge[1];
            } else if (boflx == "pptv") {
                playbo = localStorage.getItem('jx_url5') + fenge[1];
            } else {
                playbo = fenge[1];
            }

        }
        // api.toast({
        // 	msg: playbo
        // });


        bofang = fenge[1];
        var browser = api.require('webBrowser');
        browser.loadUrl({
            url: playbo
        });
    }
</script>

</html>
